import random
class RandomMartix:
    def __init__(self,seed,size):
        self.seed = seed
        self.size = size
        self.data = []
        random.seed(seed)
        for i in range(size):
            line = [random.randint(0,100) for i in range(size)]
            self.data.append(line)
    def print_(self):
        for i in range(self.size):
            for j in range(self.size):
                print(f"{self.data[i][j]:<4d}",end = '')
            print('')
seed,size = input().split()
mar = RandomMartix(int(seed),int(size))
mar.print_()